using System;
using System.Collections.Generic;
using System.Text;
using System.Xml;

namespace CaveDigital.BoardMeeting2007Lite.Minutes
{
    public sealed class Participant : IXmlExportable
    {
        string _name;
        string _role;

        #region CONSTRUCTOR
        public Participant() : this(null) { }
        public Participant(string name) : this(name, null) { }
        public Participant(string name, string role)
        {
            Name = name;
            Role = role;
        }
        #endregion

        public string Name
        {
            get { return _name; }
            set { _name = value==null?string.Empty:value; }
        }
        public string Role
        {
            get { return _role; }
            set { _role = value == null ? string.Empty : value; }
        }

        #region IXmlExportable Members

        public void XmlExport(System.Xml.XmlDocument doc, System.Xml.XmlElement parentElement)
        {
            XmlElement elem = doc.CreateElement(ServerLib.MinutesConstants.XMLNODE_ATTENDEE);
            elem.AppendChild(doc.CreateElement(ServerLib.MinutesConstants.XMLNODE_ATTENDEE_NAME));
            elem.LastChild.InnerText = Name;
            elem.AppendChild(doc.CreateElement(ServerLib.MinutesConstants.XMLNODE_ATTENDEE_ROLE));
            elem.LastChild.InnerText = Role;
            parentElement.AppendChild(elem);
        }

        #endregion
    }
}
